<template>
  <el-row class="panel-group" :gutter="40">
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class='card-panel' @click="handleSetLineChartData(item.item1.type)">
        <div class="card-panel-icon-wrapper iconfont icon-user_empty">
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">{{item.item1.name}}</div>
          <span class="card-panel-num">{{item.item1.value}}</span>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData(item.item2.type)">
        <div class="card-panel-icon-wrapper  iconfont icon-user_login ">
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">{{item.item2.name}}</div>
           <span class="card-panel-num">{{item.item1.value}}</span>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData(item.item3.type)">
        <div class="card-panel-icon-wrapper iconfont icon-overview">
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">{{item.item3.name}}</div>
           <span class="card-panel-num">{{item.item3.value}}</span>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData(item.item4.type)">
        <div class="card-panel-icon-wrapper iconfont icon-menu">
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">{{item.item4.name}}</div>
           <span class="card-panel-num">{{item.item4.value}}</span>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
export default {
   props: {
    panelData: {
      type: Object
    }
  },
  data() {
    return {
      item: this.panelData
    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    }
  },
  mounted() {

    // this.item = this.panelData;
  },
  watch:{
    panelData: function(){
        this.item = this.panelData;
    }
  },
  beforeDestroy() {
    this.item = null
  },
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.panel-group {
  margin-top: 18px;
  .card-panel-col{
    margin-bottom: 32px;
  }
  .iconfont{
    font-size: 30px;
  }
  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);
    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }
      .icon-user_empty {
         background: #40c9c6;
      }
      .icon-user_login  {
        background: #36a3f7;
      }
      .icon-overview {
        background: #f4516c;
      }
      .icon-menu {
        background: #34bfa3
      }
    }
    .icon-user_empty {
      color: #40c9c6;
    }
    .icon-user_login {
      color: #36a3f7;
    }
    .icon-overview {
      color: #f4516c;
    }
    .icon-menu {
      color: #34bfa3
    }
    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }
    .card-panel-icon {
      float: left;
      font-size: 48px;
    }
    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;
      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }
      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}
</style>
